package cn.zyy.service;

import cn.zyy.dao.StudentDao;
import cn.zyy.dao.StudentDaoImpl;
import cn.zyy.entity.Student;

import java.util.HashMap;

/**
 * 学生业务类
 */
public class StudentServiceImpl implements StudentService {
    private StudentDao studentDao = new StudentDaoImpl();

    //添加学生
    public Boolean addStudent(Student student){
        return studentDao.addStudent(student) > 0;
    }
    //根据id删除学生
    public Boolean deleteStudent(int id) {
        return studentDao.deleteStudent(id) >0;
    }
    //根据学生id和班级名称给学生分班（根据班级名称查询班级ID，然后根据学生id，更新学生的班级信息）
    public Integer classification(String className) {
        return studentDao.classification(className);
    }
    public Boolean classification(int stuId, Integer classId) {
        return studentDao.classification(stuId,classId) > 0;
    }
    //查询所有学生信息，要求显示对应班级名称
    public HashMap<String,String> selectStudent() {
        return studentDao.selectStudent();
    }
}
